<!doctype html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Template • TodoMVC</title>
	<link rel="stylesheet" href="node_modules/todomvc-common/base.css">
	<link rel="stylesheet" href="node_modules/todomvc-app-css/index.css">
	<link rel="stylesheet" href="./css/app.css">
</head>

<body>
	<section class="todoapp" v-cloak>
		<!-- 头部输入框 -->
		<header class="header">
			<h1>todos</h1>
			<input class="new-todo" placeholder="What needs to be done?" @keyup.enter="add" v-model="name">
		</header>

		<!-- 中间的列表主体 -->
		<!-- This section should be hidden by default and shown when there are todos -->
		<section class="main">
			<input id="toggle-all" class="toggle-all" type="checkbox" v-model="toggleChecked">
			<label for="toggle-all">Mark all as complete</label>
			<ul class="todo-list">
				<!-- These are here just to show the structure of the list items -->
				<!-- List items should get the class `editing` when editing and `completed` when marked as completed -->
				<li :class="{completed:item.flag , editing:item.id == nowId}" v-for="item in showList">
					<div class="view">
						<input @change="changeState(item.id)" class="toggle" type="checkbox" v-model="item.flag">
						<label @dblclick="showEdit(item.id)">{{ item.name }}</label>
						<button class="destroy" @click="del(item.id)"></button>
					</div>
					<input class="edit" v-model="item.name" @keyup.enter="edited(item.id)">
				</li>
			</ul>
		</section>

		<!-- 底部 -->
		<!-- This footer should hidden by default and shown when there are todos -->
		<footer class="footer" v-show="list.length">
			<!-- This should be `0 items left` by default -->
			<span class="todo-count"><strong>{{unfinishedNum}}</strong> item left</span>
			<!-- Remove this if you don't implement routing -->
			<ul class="filters">
				<li>
					<a :class="{selected:type == 'all'}" href="#/" @click="change('all')">All</a>
				</li>
				<li>
					<a :class="{selected:type == 'active'}" href="#/active" @click="change('active')">Active</a>
				</li>
				<li>
					<a :class="{selected:type == 'complated'}" href="#/completed" @click="change('complated')">Completed</a>
				</li>
			</ul>
			<!-- Hidden if no completed items are left ↓ -->
			<button class="clear-completed" @click="clearComplated" v-show="list.some(item => item.flag)">Clear completed</button>
		</footer>
	</section>
	<script src="./node_modules/axios/dist/axios.js"></script>
	<script src="./node_modules/vue/dist/vue.js"></script>
	<script src="./js/app.js"></script>
</body>

</html>